Skip to content

feat(dramatiq): Support span streaming#6273

Merged
sl0thentr0py merged 3 commits into
masterfrom
neel/span-first-dramatiq
May 18, 2026
Merged

feat(dramatiq): Support span streaming#6273
sl0thentr0py merged 3 commits into
masterfrom
neel/span-first-dramatiq

Conversation

@sl0thentr0py
Copy link
Copy Markdown
Member

@sl0thentr0py sl0thentr0py commented May 15, 2026

Issues

@sl0thentr0py sl0thentr0py requested a review from a team as a code owner May 15, 2026 13:42
@sl0thentr0py sl0thentr0py marked this pull request as draft May 15, 2026 13:43
@sl0thentr0py sl0thentr0py removed the request for review from a team May 15, 2026 13:43
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

Codecov Results 📊

79 passed | Total: 79 | Pass Rate: 100% | Execution Time: 1.06s

All tests are passing successfully.

❌ Patch coverage is 11.76%. Project has 16047 uncovered lines.

Files with missing lines (1)
File Patch % Lines
dramatiq.py 13.56% ⚠️ 102 Missing

Generated by Codecov Action

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 15, 2026

PY-2318

@sl0thentr0py sl0thentr0py force-pushed the neel/span-first-dramatiq branch 2 times, most recently from 326b013 to 4b5aa52 Compare May 18, 2026 12:38
@sl0thentr0py sl0thentr0py marked this pull request as ready for review May 18, 2026 12:38
@sl0thentr0py sl0thentr0py requested a review from a team May 18, 2026 12:42
Copy link
Copy Markdown
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple things, please see comments

Comment thread sentry_sdk/integrations/dramatiq.py
Comment thread sentry_sdk/integrations/dramatiq.py Outdated
if not is_event_capture_required:
# normal transaction finish
transaction.__exit__(None, None, None)
span_ctx.__exit__(None, None, None)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The canonical way to do this in span first would just be span.end(), but I get that this way it's compatible with both legacy and span streaming mode

sl0thentr0py and others added 3 commits May 18, 2026 14:57
Add a span-streaming branch in SentryMiddleware.before_process_message
and after_process_message alongside the legacy transaction-based path,
gated on has_span_streaming_enabled. The streaming branch uses
sentry_sdk.traces.continue_trace + start_span and stashes the span
context manager on the message so the after-hook can exit it without
relying on scope.transaction (which doesn't exist in streaming mode).

Parametrize the tracing tests over span_streaming True/False so both
modes are covered.

Refs GH-5386
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
@sl0thentr0py sl0thentr0py force-pushed the neel/span-first-dramatiq branch from 5e0f289 to a118d2f Compare May 18, 2026 12:58
@sl0thentr0py sl0thentr0py merged commit 80b4cd8 into master May 18, 2026
156 checks passed
@sl0thentr0py sl0thentr0py deleted the neel/span-first-dramatiq branch May 18, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate dramatiq to span first

2 participants